<?php 
// Create the image 
$im = imagecreatetruecolor(609, 80); 

// Create some colors 
$white = imagecolorallocate($im, 255, 255, 255); 
$black = imagecolorallocate($im, 0, 0, 0); 
imagefilledrectangle($im, 0, 0, 609, 100, $white); 

// The text to draw 

$text =TITLE;//"Your Team Management"; 

// Replace path by your own font path 
$font = 'arial.ttf'; // Place this file in your code directory or if font is in font directory set its path with font name as $font=$path.'arial.ttf'; 

// Add the text 
$x=10; 
$y=50; 
$font_size=40; 
$angle=0; 
$total_width=0; 
$counter=0; 

for($i=0; $i<strlen($text); $i++) 
{ 
    //$text_to_write=urldecode(substr($text,$i,1)."%0D_"); 
    $dimensions = imagettfbbox($font_size, $angle, $font, substr($text,$i,1)); 
    $total_width+=($dimensions[2]); 
    
    
    
} 
$dimensions = imagettfbbox($font_size, $angle, $font, $text); 

$difference=$dimensions[2]-$total_width; 

imagettftext($im, $font_size, $angle, $x+1, $y+1, $black, $font, $text); 
imagettftext($im, $font_size, $angle, $x, $y, $black, $font, $text); 

$x2=$x+$total_width+$difference+2; 
//echo $total_width; 
imageline( $im , $x , $y+4 , $x2 , $y+4 , $black ); 
//imageBoldLine($im, $x, $y+4, $x2, $y+4, $black, $BoldNess=4, $func='imageLine'); 

// Using imagepng() results in clearer text compared with imagejpeg() 
imagepng($im,"underline.png"); 
echo "<img src='underline.png'/>"; 
imagedestroy($im); 
?>